import request from '@/utils/request'

/**
 * 过滤user
 * @param {page,size,orderBys,columParams} params
 */
const search = function(data) {
  return request({
    url: '/web/admin/user!search',
    method: 'post',
    data
  })
}

/**
 * 查询user
 * @param {page=*&size=*&keyword=*} params
 */
const filter = function(params) {
  return request({
    url: '/web/admin/user',
    method: 'get',
    params
  })
}

/**
 * 创建demo对象
 * @param {userInfoEntity} data
 */
const create = function(data) {
  return request({
    url: '/web/admin/user',
    method: 'post',
    data
  })
}

/**
 * 更新user对象
 * @param {userInfoEntity} data
 */
const update = function(data) {
  return request({
    url: '/web/admin/user',
    method: 'patch',
    data
  })
}

/**
 * 删除demo对象
 * @param {id} data
 */
const remove = function(data) {
  return request({
    url: '/web/admin/user',
    method: 'delete',
    data
  })
}

/**
 * 批量删除demo对象
 * @param {ids: [num,num...]} ids id数组逗号隔开
 */
const removeMulti = function(ids) {
  return request({
    url: '/web/admin/user/multi',
    method: 'delete',
    data: ids
  })
}

const apiUser = {
  search,
  filter,
  create,
  update,
  remove,
  removeMulti
}

/**
 * 将demo模块的api打包输出
 */
export default apiUser
